Skip to content

Feat/delta slippage param#227

Open
0xNazarii wants to merge 20 commits intomasterfrom
feat/deltaSlippageParam
Open

Feat/delta slippage param#227
0xNazarii wants to merge 20 commits intomasterfrom
feat/deltaSlippageParam

Conversation

@0xNazarii
Copy link

@0xNazarii 0xNazarii commented Mar 11, 2026

Note

Medium Risk
Changes Delta order amount computation by introducing a new slippage parameter that auto-derives srcAmount/destAmount and infers side, which could affect order quoting/execution if callers rely on the old explicit-amount behavior. Test and snapshot removals reduce coverage for limit/NFT orders, increasing regression risk outside Delta.

Overview
Adds first-class slippage handling to Delta order construction: buildDeltaOrder now accepts slippage (in bps) and will auto-compute the missing amount from deltaPrice (SELL computes destAmount minimum; BUY computes srcAmount maximum) while inferring side when slippage is used.

Updates examples/delta.ts to pass slippage instead of manually calculating destAmount, adds unit tests covering BUY/SELL slippage behavior, and adjusts snapshots. Separately removes the large Jest snapshot files and test suites for limit orders/NFT orders (plus related test ABIs/bytecode/helpers), and updates remaining snapshots to reflect current quote/tx fields (e.g., contractMethod, partnerFee).

Written by Cursor Bugbot for commit fc8f6ec. This will update automatically on new commits. Configure here.

@github-actions
Copy link

github-actions bot commented Mar 11, 2026

size-limit report 📦

Path Size
dist/sdk.cjs.production.min.js 16.48 KB (+0.69% 🔺)
dist/sdk.esm.js 16.46 KB (+0.92% 🔺)

.gitignore Outdated
Comment on lines +17 to +19
src/**/*.js
src/**/*.d.ts
src/**/*.d.ts.map
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? I don't think we have any files like these under src/

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I ran tsc to check for build and saw all of those files in the diff. now thinking updating tsconfig to include outDir would be be better

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted this and added outDir option d80d459

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You just want to run tsc to check if types are alright, but don't want to run the whole build script?
Do npx tsc --noEmit then, no need to emit anything, no need for outDir

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right, no idea what I was thinking 🤦

Comment on lines +244 to +248
function applySlippage(
amount: string,
slippageBps: number,
increase: boolean
): string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually prefer object as input, more readable that way

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated 8f66540

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants